package com.molichuxing.services.business.service.impl;

import com.molichuxing.services.business.dto.response.VehicleBizDto;
import com.molichuxing.services.business.dto.response.VehicleModlemakeBizDto;
import com.molichuxing.services.business.dto.response.VehicleNameBizDto;
import com.molichuxing.services.business.service.SubCompanyBizService;
import com.molichuxing.services.business.service.VehicleBizService;
import com.molichuxing.services.infrastructure.dto.response.*;
import com.molichuxing.services.infrastructure.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 分子公司实现类
 * </p>
 *
 */
@Service("subCompanyBizService")
public class SubCompanyBizServiceImpl implements SubCompanyBizService {
	private static final Logger logger = LoggerFactory.getLogger(SubCompanyBizServiceImpl.class);

	@Resource
	private RegionService regionService;

	@Resource
	private SubcompanyService subcompanyService;

	@Override
	public List<SubcompanyDto> getSubcompanyByCityId(Integer provinceId) {
		List<Integer> ids = null;
		if(null != provinceId) {
			ids = new ArrayList<>();
			List<RegionDto> regionDtoList = regionService.getCityListByProvinceId(provinceId);
			if((null == regionDtoList)||(regionDtoList.size() == 0)) {
				return null;
			}
			for(RegionDto regionDto : regionDtoList) {
				ids.add(regionDto.getId());
			}
		}
		return subcompanyService.getSubcompanyByCityId(ids);
	}
}
